require 'uri'
require 'net/http'
require 'base64'



module ApplicationHelper

    # ruby objects -> json -> base64 post -> base64 response -> json > ruby objects
    def riaproxy_post (command, args)
        args     = args.delete_if { |key, val| val == nil }
        data_b64 = Base64.encode64( { :command => command, :args => args }.to_json )
        resp_b64 = Net::HTTP.post_form(URI.parse('http://10.0.7.28/sw/sw_proxy/'), {'data' => data_b64}).body
        resp     = JSON.parse(Base64.decode64(resp_b64))
    end


end



